/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.beans.jpa;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author waumovil-javaengineer
 */
@Entity
@Table(name = "caculo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Caculo.findAll", query = "SELECT c FROM Caculo c"),
    @NamedQuery(name = "Caculo.findById", query = "SELECT c FROM Caculo c WHERE c.id = :id"),
    @NamedQuery(name = "Caculo.findByQuery", query = "SELECT c FROM Caculo c WHERE c.query = :query"),
    @NamedQuery(name = "Caculo.findByEstado", query = "SELECT c FROM Caculo c WHERE c.estado = :estado"),
    @NamedQuery(name = "Caculo.findByDescripcion", query = "SELECT c FROM Caculo c WHERE c.descripcion = :descripcion"),
    @NamedQuery(name = "Caculo.findByCreado", query = "SELECT c FROM Caculo c WHERE c.creado = :creado"),
    @NamedQuery(name = "Caculo.findByModificado", query = "SELECT c FROM Caculo c WHERE c.modificado = :modificado")})
public class Caculo implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1000)
    @Column(name = "query")
    private String query;
    @Basic(optional = false)
    @NotNull
    @Column(name = "estado")
    private int estado;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "descripcion")
    private String descripcion;
    @Basic(optional = false)
    @NotNull
    @Column(name = "creado")
    @Temporal(TemporalType.DATE)
    private Date creado;
    @Column(name = "modificado")
    @Temporal(TemporalType.DATE)
    private Date modificado;
    @JoinColumn(name = "responsable", referencedColumnName = "usuario")
    @ManyToOne(optional = false)
    private Usuario responsable;
    @JoinColumn(name = "grupocalculo", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private GrupoCalculo grupocalculo;

    public Caculo() {
    }

    public Caculo(Integer id) {
        this.id = id;
    }

    public Caculo(Integer id, String query, int estado, String descripcion, Date creado) {
        this.id = id;
        this.query = query;
        this.estado = estado;
        this.descripcion = descripcion;
        this.creado = creado;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public int getEstado() {
        return estado;
    }

    public void setEstado(int estado) {
        this.estado = estado;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Date getCreado() {
        return creado;
    }

    public void setCreado(Date creado) {
        this.creado = creado;
    }

    public Date getModificado() {
        return modificado;
    }

    public void setModificado(Date modificado) {
        this.modificado = modificado;
    }

    public Usuario getResponsable() {
        return responsable;
    }

    public void setResponsable(Usuario responsable) {
        this.responsable = responsable;
    }

    public GrupoCalculo getGrupocalculo() {
        return grupocalculo;
    }

    public void setGrupocalculo(GrupoCalculo grupocalculo) {
        this.grupocalculo = grupocalculo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += ( id != null ? id.hashCode() : 0 );
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!( object instanceof Caculo )) {
            return false;
        }
        Caculo other = (Caculo) object;
        if (( this.id == null && other.id != null ) || ( this.id != null && !this.id.equals(other.id) )) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.easoftware.code.beans.jpa.Caculo[ id=" + id + " ]";
    }
}
